This fixes the v8.getHeapSnapshot() calls not properly being
destroyed. Pipeline calls would for example not properly end
without the callback being in place.
PR-URL: https://github.com/nodejs/node/pull/58846
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Gbp-Pq: Topic sec
Gbp-Pq: Name 19-v8-fix-missing-callback-in-heap-utils-destroy.patch
this[kHandle].readStart();
}
- _destroy() {
+ _destroy(err, callback) {
// Release the references on the handle so that
// it can be garbage collected.
this[kHandle][owner_symbol] = undefined;
this[kHandle] = undefined;
+ callback(err);
}
[kUpdateTimer]() {
const { writeHeapSnapshot, getHeapSnapshot } = require('v8');
const assert = require('assert');
const fs = require('fs');
+const { promises: { pipeline }, PassThrough } = require('stream');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
JSON.parse(data);
}));
}
+
+{
+ const passthrough = new PassThrough();
+ passthrough.on('data', common.mustCallAtLeast(1));
+
+ pipeline(
+ getHeapSnapshot(),
+ passthrough,
+ ).then(common.mustCall());
+}